package scuba.DiveBuddy.Fragments;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.EditText;
import scuba.DiveBuddy.Enums.DistanceEnum;
import scuba.DiveBuddy.R;

/**
 * @author Alex Anderson
 * @version 1.0
 * @since {24/02/14}
 */
public class DepthSelectDialogFragment extends DialogFragment {

    public interface DepthSelectionChangedListener {
        public void OnDepthChanged(int maxDepth, DistanceEnum units);
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        DepthSelectionChangedListener mListener;
        try {
            mListener = (DepthSelectionChangedListener)activity;
        }
        catch(ClassCastException e) {
            throw new ClassCastException(activity.toString()
                    + " must implement NumberChangedListener");
        }
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage("Pick Number")
                .setView(getActivity().getLayoutInflater().inflate(0, null)) //todo: glaring error
                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        //
                    }
                })
                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        //do nothing
                    }
                });

        return builder.create();
    }
}
